<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>科室列表</title>
	
	<script type="text/javascript"
		src="../static/assets/jquery/jquery-1.10.2.min.js"></script>
	<script type="text/javascript" src="../static/js/common.js"></script>
	
	<script type="text/javascript">
		function del(url){
			if(confirm('您确定要删除本科室信息？科室删除后，该科室下的所有医生信息都将被删除，请谨慎操作！！！')) {
				
				$.get(url, function(data) {
					alert(data.msg);
					location.reload();
				});
			}
		 }
	</script>
</head>
<body>

	<form name="searchForm" action="/admin/department/search" method="post">
	
		<div><span>
		
		科室<input type="text" name="name" id="name" value="${searchName!}" ></input>&nbsp;&nbsp;
		<select name="directorId">
			<option value="-1">请选择科室主任</option> 
			<#list doctors as doctor> 
				<#if doctor.id == searchDirectorId>
					<option value="${doctor.id}" selected="selected">${doctor.name}</option>
				<#else>
					<option value="${doctor.id}">${doctor.name}</option> 
				</#if> 
			</#list>
		</select>
		
		<select name="key">
			<option value="-1" >科室级别</option>
			<option value="1" <#if searchKey == 1 >selected="selected"</#if> >重点科室</option>
			<option value="0" <#if searchKey == 0 >selected="selected"</#if> >普通科室</option>
		</select>
		
		<input type="submit" name="subButton" id="subButton" value="查询" />		
		
		</span>
		
		</div>
		
	</form>

	<style>
		table {
			width: 100%;
		}
		
		th {
			height:25px;
			line-height:25px;
		}
		
		td{
			line-height:25px;
		}
	</style>
	
	
	<div>科室信息</div>
	<table border="1" cellspacing="0" cellpadding="0" >
		<thead>
			<th>科室名称</th>
			<th>科室图片</th>
			<th>科室级别</th>
			<th>科室描述</th>
			<th>科室主任</th>
			<th>操作</th>
		</thead>
		<tbody>
			<#list departmentList.list as department>
			<tr>
				<td>${department.name}</td>
				<td><img src="${(department.image)!}" onload="resizeImage(this, 80, 120);" /></td>
				<td><#if department.key == 1>重点科室<#else>普通科室</#if></td> 
				<td>${department.desc}</td> 
				<td>${(department.getDirector().name)!}</td>
				<td>&nbsp;&nbsp;&nbsp;<a
					href="/admin/department/edit/${department.id}">编辑</a>
					&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)"
					onclick="del('/admin/department/delete/${department.id}')">删除</a>
				</td>
			</tr>
			</#list>
		</tbody>
	</table>
	

	<div>
		<span style="margin-left: 10px"> 
		总共记录 ：${departmentList.totalRow} 条；共${departmentList.totalPage} 页；第 ${departmentList.pageNumber} 页； 
		<a href="/admin/department/?p=1<#if searchPage == 1>&s=1</#if>" >[首页]</a>
		<a href="/admin/department/?p=<#if departmentList.pageNumber lte 1>1<#else>${departmentList.pageNumber - 1}</#if><#if searchPage == 1>&s=1</#if>" >[上一页]</a> 
		<a href="/admin/department/?p=<#if departmentList.pageNumber gte departmentList.totalPage>${departmentList.totalPage}<#else>${departmentList.pageNumber + 1}</#if><#if searchPage == 1>&s=1</#if>" >[下一页]</a> 
		<a href="/admin/department/?p=${departmentList.totalPage}<#if searchPage == 1>&s=1</#if>" >[末页]</a>
		每页显示${departmentList.pageSize}条数据 
		</span>
	</div>

</body>
</html>